from meiduo_admin.my_paginate import MyPageNumberPagination
from rest_framework.viewsets import ModelViewSet
from . import channel_serializers
from goods.models import GoodsChannel,GoodsCategory,GoodsChannelGroup
from rest_framework.generics import ListAPIView


# 1.商品列表展示
class ChannelViewSet(ModelViewSet):
    pagination_class = MyPageNumberPagination
    serializer_class = channel_serializers.ChannelViewSerializer
    queryset = GoodsChannel.objects.all()

# 2.商品列表组显示
class ChannelTypeView(ListAPIView):

    serializer_class = channel_serializers.ChannelTypeViewSerializer
    queryset = GoodsChannelGroup.objects.all()

# 3.商品一级分类显示
class ChannelCategoriesView(ListAPIView):
    serializer_class = channel_serializers.ChannelCategoriesViewSerializer
    queryset = GoodsCategory.objects.all()